diff --git a/sympy/tensor/tensor.py b/sympy/tensor/tensor.py
index ff770347d3..5b3b5248f1 100644
--- a/sympy/tensor/tensor.py
+++ b/sympy/tensor/tensor.py
@@ -2897,6 +2897,7 @@ def __getitem__(self, item):
 
     def _extract_data(self, replacement_dict):
         from .array import Array
+
         for k, v in replacement_dict.items():
             if isinstance(k, Tensor) and k.args[0] == self.args[0]:
                 other = k
@@ -2919,18 +2920,23 @@ def _extract_data(self, replacement_dict):
                     raise NotImplementedError("%s with contractions is not implemented" % other)
             # Remove elements in `dum2` from `dum1`:
             dum1 = [pair for pair in dum1 if pair not in dum2]
-        if len(dum1) > 0:
-            indices2 = other.get_indices()
-            repl = {}
-            for p1, p2 in dum1:
-                repl[indices2[p2]] = -indices2[p1]
-            other = other.xreplace(repl).doit()
-            array = _TensorDataLazyEvaluator.data_contract_dum([array], dum1, len(indices2))
 
+        indices2 = other.get_indices()
+        repl = {}
+        for p1, p2 in dum1:
+            repl[indices2[p2]] = -indices2[p1]
+        other = other.xreplace(repl).doit()
+
+        # Apply the metric before contraction
         free_ind1 = self.get_free_indices()
         free_ind2 = other.get_free_indices()
+        array, free_ind1, free_ind2 = self._match_indices_with_other_tensor(array, free_ind1, free_ind2, replacement_dict)
 
-        return self._match_indices_with_other_tensor(array, free_ind1, free_ind2, replacement_dict)
+        # Perform the contraction after the metric has been applied
+        if len(dum1) > 0:
+            array = _TensorDataLazyEvaluator.data_contract_dum([array], dum1, len(indices2))
+
+        return free_ind1, array
 
     @property
     def data(self):
@@ -2940,16 +2946,12 @@ def data(self):
     @data.setter
     def data(self, data):
         deprecate_data()
-        # TODO: check data compatibility with properties of tensor.
-        _tensor_data_substitution_dict[self] = data
+        raise ValueError("Not possible to set component data to a tensor expression")
 
     @data.deleter
     def data(self):
         deprecate_data()
-        if self in _tensor_data_substitution_dict:
-            del _tensor_data_substitution_dict[self]
-        if self.metric in _tensor_data_substitution_dict:
-            del _tensor_data_substitution_dict[self.metric]
+        raise ValueError("Not possible to delete component data to a tensor expression")
 
     def _print(self):
         indices = [str(ind) for ind in self.indices]
@@ -3576,12 +3578,12 @@ def _get_indices_to_args_pos(self):
         """
         pos_map = dict()
         pos_counter = 0
-        for arg_i, arg in enumerate(self.args):
+        for i, arg in enumerate(self.args):
             if not isinstance(arg, TensExpr):
                 continue
             assert isinstance(arg, Tensor)
-            for i in range(arg.ext_rank):
-                pos_map[pos_counter] = arg_i
+            for j in range(arg.ext_rank):
+                pos_map[pos_counter] = i
                 pos_counter += 1
         return pos_map
 
